#define __samp03 2

#include <a_master>
#include <bodyparts>

#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
	(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(PRESSED(KEY_HANDBRAKE | KEY_FIRE)&&!IsPlayerInAnyVehicle(playerid))
	{
		new pw = GetPlayerWeapon(playerid);
		if(pw < 22 || pw > 38) return true;
		new Float:pvel[3];
		GetPlayerVelocity(playerid, pvel[0], pvel[1], pvel[2]);
		if(!pvel[2] && (pvel[0] > -0.1 && pvel[0] < 0.1) && (pvel[1] > -0.1 && pvel[1] < 0.1))
		{
			new victimid = IsPlayerAimingBodyPart(playerid, BODY_PART_HEAD);
			if(victimid != INVALID_PLAYER_ID)
			{
				GameTextForPlayer(playerid, "Headshot", 4000, 5);
				GameTextForPlayer(victimid, "Headshot", 4000, 5);
				SetPlayerHealth(victimid, 0.0);
			}
		}
	}
	return 1;
}